<template>
    <div class="conMain">
        <div class="fasterKey">
            <h4>快捷下单</h4>
            <div><input class="keyInput" placeholder="可输入首字母或序号" v-model="keyTxt" @keydown.enter="inputKey()"/></div>
            <div><button @click="inputKey()">下单</button></div>
            <div class="custom-box">
                <p>常用选择：</p>
                <div class="custom-list">
                    <p>用户自定义：<span v-if="customLis.length == 0">暂无</span></p>
                    <div class="custom-li">
                        <div class="custom-item" v-for="item in customLis" :key="item.id" @click="showDetails(item)">
                            <span :title="`${item.classifyname}/${item.catalogname}`">{{item.classifyname}}/{{item.catalogname}}</span>
                            <span @click.stop="removeCustom(item.id)">&times;</span>
                        </div>
                        <div class="custom-item add-btn" v-if="customLis.length < 5" @click="showCatalogPop"> + </div>
                    </div>
                </div>
                <div class="custom-list">
                    <p>系统推荐：</p>
                    <div class="custom-li">
                        <div class="custom-item" v-for="(item,index) in topLis" :key="item.id" @click="showDetails(item)">
                            <span :title="`${item.classifyname}/${item.catalogname}`">{{item.classifyname}}/{{item.catalogname}}</span>
                            <span>{{index+1}}</span>
                        </div>
                    </div>
                </div>
            </div>

            <div class="bg-pop" v-if="isShowPop" @click="closePop"></div>
            <div class="select-pop" v-if="isShowCataPop">
                <div class="select-head">
                    <input type="text" :value="`${classify}-${catalog}`" disabled>
                    <button @click="saveCustom">确定</button>
                </div>
                <div class="select-body">
                    <div class="select-left">
                        <ul class="itemUl">
                            <li class="itemLi" v-for="item in classifyLis" :key="item.id" @click="selectClassify(item.id,item.title)"><em>vertical-align: middle;</em><span>{{item.title}}</span></li>
                        </ul>
                    </div>
                    <div class="select-right">
                        <ul class="itemUl">
                            <li class="itemLi" v-for="item in catalogLis" :key="item.id" @click="selectCatalog(item.id,item.title)"><em>vertical-align: middle;</em><span>{{item.title}}</span></li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="pop-con conMain confirm-pop" v-if="isShowConfirm">
                <div class="confirm-head">
                    <span class="title">快捷下单信息确认</span>
                    <span class="close" @click="closePop">&times;</span>
                </div>
                <div class="confirm-body" v-if="isShowStart">
                    <p class="con-p">先确认起点科室</p>
                    <div class="room-list">
                        <ul>
                            <li class="select-item" :key="index" v-for="(item,index) in roomLis" @click="saveStartRoom(item.name)">
                                <a class="btn"><span>{{item.name}}</span></a>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="confirm-body" v-else>
                    <div class="confirm-left">
                        <p>订单信息</p>
                        <div class="input-wrap">
                            <div class="title"><span>*</span>输送类别</div>
                            <div class="con pointer" id="classify" @click="selectTab(9)">{{info.classify}}</div>
                        </div>
                        <div class="input-wrap">
                            <div class="title"><span>*</span>输送项目</div>
                            <div class="con pointer" @click="showCatalog">{{info.catalog}}</div>
                        </div>
                        <div class="input-wrap">
                            <div class="title"><span>*</span>输送起点</div>
                            <div id="start" class="con pointer" @click="selectTab(8)">{{info.askdept}}</div>
                        </div>
                        <div class="input-wrap">
                            <div class="title">
                                <span v-if="info.classify == '病人运送'">*</span>
                                起点床号
                            </div>
                            <div class="con">
                                <!-- <span class="add-btn" @click="">新增</span> -->
                                <input type="text" class="bedno" v-model="info.bedno">
                            </div>
                        </div>
                        <div class="input-wrap">
                            <div class="title">目的地</div>
                            <div class="con pointer" @click="selectTab(3)">{{info.address}}</div>
                        </div>
                        <div class="input-wrap">
                            <div class="title"><span v-if="info.classify == '病人运送'">*</span>携带设备</div>
                            <div class="con pointer" @click="showTackle">{{info.tour}}</div>
                        </div>
                        <div class="input-wrap">
                            <div class="title">下单备注</div>
                            <div class="con"><input type="text" class="memo" v-model="info.memo"></div>
                        </div>
                        <div id="date-time" class="input-wrap">
                            <div class="title" style="color:red;">预约时间</div>
                            <div class="clear-btn" v-show="info.fixedtime != ''" @click="cancelAppointmentTime">&times;</div>
                            <div class="pointer con" @click="showAppointmentTime">{{info.fixedtime}}</div>
                            <date-time
                                :date="orderTime"
                                :option="orderOption"
                                :limit="limit"
                                class="small"
                                @cancel="cancelAppointmentTime"
                                @change="setAppointmentTime"
                            ></date-time>
                        </div>

                        <div class="input-wrap fast">
                            <input :class='info.attribute == 3?"fastorder":""' @click="switchFastorder" type="button" value="急单">
                        </div>

                        <button @click="submitCheck" class="btn">{{submitTxt}}</button>
                        <p class="tips-txt">注：带 <em class="red">*</em> 的为必填项</p>
                    </div>
                    <div class="confirm-right" v-if="showIndex!=3 && showIndex!=8">
                        <div class="select-wrap">
                            <p v-if="showIndex==9">选择输送类别</p>
                            <p v-if="showIndex==10">选择输送项目</p>
                            <p v-if="showIndex==4">选择携带设备</p>
                            <ul class="itemUl" v-if="showIndex==9"><!--类别-->
                                <li class="itemLi" :key="item.id" v-for="item in classifyLis" @click="saveClassify(item.id,item.title)"><span>{{item.title}}</span></li>
                            </ul>
                            <ul class="itemUl" v-if="showIndex==10"><!--项目-->
                                <li class="itemLi" :key="item.id" v-for="item in catalogLis" @click="saveCatalog(item.id,item.title)"><span>{{item.title}}</span></li>
                            </ul>
                            <!--病人列表-->
                            <!-- <ul class="itemUl" v-if="showIndex==11">
								<li class="itemLi" :key="item.id" v-for="item in patientLis" @click="selectPatient(item)"><span>{{item.Name}}{{item.BedNo == ''?'':' 床号:'+item.BedNo}}</span></li>
							</ul> -->
                            <ul class="itemUl" v-if="showIndex==4"><!--设备-->
                                <li :class="[item.isActive ? 'itemLi-active' : '', 'itemLi']" :key="item.id" v-for="item in tackleLis" @click="selectTackle(item.title)"><span>{{item.title}}</span></li>
                            </ul>
                        </div>
                    </div>
                    <div class="confirm-right noTitle" v-if="showIndex==3 || showIndex==8">
                        <p class="title" v-if="showIndex==3">选择输送目的地</p>
                        <p class="title" v-if="showIndex==8">选择输送起点</p>
                        <vue-cascader
                            :data="addrData"
                            :isMulti="isMulti"
                            :size="addrSize"
                            :backBtnText="btnText"
                            :backBtnStyles="backBtnStyles"
                            :backBtnHover="backBtnHover"
                            :backBtnPosi="backBtnPosi"
                            @callback="getFullName"
                        />
                    </div>
                </div>
            </div>

            <div class="bg-pop fast-bg-pop" v-if="againSure"></div>
            <div class="patientModal" v-if="againSure">
                <div class="pHead">是否发送</div>
                <div class="pBody">
                    <div class="pType" v-if="info.bedno != ''">病人床号 {{info.bedno}}　的检查项目：</div>
                    <div class="pCont">
                        <div class="pNum">{{info.classify}} - {{info.catalog}}</div>
                    </div>
                </div>
                <div class="pBottom">
                    <button class="sure" @click="submitForm">确认</button>
                    <button class="cancel" @click="againSure=false">取消</button>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
    import dateTime from '../tips/calendar2.vue'
    import today from '../common/today'
    import common from '../common/com'
    import {
        catalogInputUrl,
        submitUrl,
        tackleUrl,
        topUrl,
        catalogUrl,
        classifyUrl,
        delCustomUrl,
        saveCustomUrl,
        customUrl,
        addressUrl,
        destUrl
    } from '../common/ajax'
    export default{
        components:{
            'date-time':dateTime
        },
        props:{
            start:'',
            roomLis:'',
            needSetBad:''
        },
        data(){
            return{
                submitTxt:'确定',
                starts:'',
                startRoom:'',
                isStartOk:false,
                keyTxt:'',
                classify:'',
                classifyId:'',
                catalog:'',
                catalogId:'',
                startNotes:'',
                finish:'',
                tackle:'无',
                // notes:'',
                tackleLis:[],
                // tackleShow:false,
                isShowStart: false,     // 是否显示起点科室选择弹窗
                isSubmit:true, //提交
                classifyLis:[],
                catalogLis:[],
                topLis:[],          // 系统推荐top5
                againSure: false,   // 订单确认弹窗
                //详情
                showIndex: 0,
                info: {
                    attribute: '1', // 1:普通 2:预约 3:急单
                    classifyId:'',
                    classify:'',
                    catalogId:'',
                    catalog:'',
                    askdept:'', // 起点
                    bedno:'',   // 床号
                    address:'', // 目的地
                    tour:'',    // 设备
                    memo:'',    // 备注
                    fixedtime:''    // 预约时间
                },
                // 时间选择器
                orderTime:{
                    time:''
                },
                orderOption:{
                    type: 'min',
                    week: ['一', '二', '三', '四', '五', '六', '日'],
                    month: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
                    format: 'YYYY-MM-DD HH:mm',
                    placeholder: '预约时间',
                    inputStyle: {
                        'width':'0',
                        'height':'0'
                    },
                    color: {
                        header: '#46bd9e',
                        headerText: '#fff'
                    },
                    buttons: {
                        ok: '确定',
                        cancel: '取消'
                    },
                    overlayOpacity: 0.5, // 0.5 as default
                    dismissible: true // as true as default
                },
                limit: [
                    {
                        type: 'fromto',
                        from: today.tmr(-1)
                    }
                ],
                // 自定义
                currSelect:null,    // 当前选中的自定义/系统推荐选项
                fullName: '',
                customLis:[],
                isShowPop:false,     // 显示遮罩层
                isShowCataPop:false, // 显示科室选择层
                isShowConfirm:false, // 显示起点确认层
                // 地址选择
                addrData: [],
                addrSize: 'small',
                isMulti: false,
                btnText: '返回',
                backBtnStyles:{
                    background: '#ffd4c6',
                    color: '#fd2b2b'
                },
                backBtnHover:{
                    background: 'red',
                    color: '#fff'
                },
                backBtnPosi:'top'
            }
        },
        methods:{
            // 急单切换
            switchFastorder(){
                if(this.info.attribute == 1){
                    this.info.attribute = 3;
                    return
                }
                if(this.info.attribute == 3){
                    this.info.attribute = 1;
                    return
                }
            },
            //设置预约时间
            showAppointmentTime(){
                jQuery('#date-time .cov-vue-date input').click();
            },
            setAppointmentTime(m){
                this.info.attribute = 2;
                this.info.fixedtime = m;
                jQuery('#classify').click()
            },
            cancelAppointmentTime(){
                this.info.fixedtime = '';
                this.info.attribute = 1;
            },
            // 保存起点科室、输送类别、输送项目
            saveStartRoom(title){
                sessionStorage.setItem('preRomm', title)
                this.isShowStart = false;
                this.showDetails(this.info,"下单")
            },
            saveClassify(id,title){
                this.info.classifyId = id
                this.info.classify = title
                this.loadCatalog(1);
                this.selectTab(10);
            },
            saveCatalog(id,title){
                this.info.catalogId = id
                this.info.catalog = title
                this.info.address == '' ? this.selectTab(3) : this.selectTab(0)
            },
            showTackle(){
                this.loadTackle()
                this.selectTab(4)
            },
            showCatalog(){
                this.loadCatalog(0);
                this.selectTab(10);
            },
            // 切换
            selectTab(index){
                this.showIndex = index;
            },
            showDetails(item, text){
                console.log(item);
                this.currSelect = item;
                this.isShowPop = true;
                this.isShowConfirm = true;
                if(text != '下单'){
                    this.info.classify = item.classifyname
                    this.info.catalog = item.catalogname
                    this.info.classifyId = item.classifyid
                    this.info.catalogId = item.catalogid
                }
                if(!sessionStorage.getItem('preRomm') && !this.isStartOk) {
                    this.isShowStart = true;
                    return;
                }else{
                    this.info.askdept = this.startRoom + sessionStorage.getItem('preRomm')
                }

                
                jQuery.ajax({
                    url: destUrl,
                    type: 'post',
                    data:{
                        'classifyid': this.info.classifyId,
                        'catalogid': this.info.catalogId
                    },
                    success: function(data){
                        if(data.success){
                            if(item.catalogname == '取药'){
                                this.info.address = this.info.askdept
                                this.info.askdept = data.data.title
                            }else {
                                this.info.address = data.data.title
                            }
                        }else {
                            throwErrorTips('',data.msg)
                        }
                    }.bind(this),
                    error: function(data,s){
                        throwErrorTips('',s)
                    }
                })
            },
            // 新地址选择
            getFullName(item){
                let str = item.join(' ')
                if(this.showIndex == 3){
                    this.info.address = str
                    this.selectTab(3);
                    this.loadNewAddress();
                }
                if(this.showIndex == 8){
                    this.info.askdept = str
                    this.selectTab(8);
                }
            },
            loadNewAddress(){
                jQuery.ajax({
                    url: addressUrl,
                    type: 'get',
                    cache: false,
                    success: function(data){
                        if(data.success){
                            var newData = common.roomMerge(data.data, this.$root.$data.cid)
                            this.addrData = newData;
                        }else {
                            throwErrorTips('获取地址信息失败',data.msg)
                        }
                    }.bind(this)
                })
            },
            // 自定义展示、新增、删除
            loadCustom(){
                jQuery.ajax({
                    url: customUrl,
                    type: 'get',
                    cache: false,
                    success: function(data){
                        if(data.success){
                            this.customLis = data.data
                        }else {
                            throwErrorTips('',data.msg)
                        }
                    }.bind(this),
                    error: function(data){
                        throwErrorTips('',data.msg)
                    }
                })
            },
            saveCustom(){
                if(this.classify == '' || this.catalog == '') {
                    this.$Message({type:'error',message:'类别和项目均不能为空'})
                    return;
                }
                let flag = false;
                this.customLis.forEach(v => {
                    if(v.classifyname == this.classify && v.catalogname == this.catalog) flag = true;
            })
                if(!flag){
                    let form = {
                        classifyid: parseInt(this.classifyId),
                        classifyname: this.classify,
                        catalogid: parseInt(this.catalogId),
                        catalogname: this.catalog
                    }
                    jQuery.ajax({
                        url: saveCustomUrl,
                        type: 'post',
                        dataType: 'json',
                        data: form,
                        success: function(data){
                            if(data.success){
                                this.closePop()
                                let newData = Object.assign({}, form, {id: data.data})
                                this.customLis.push(newData)
                            }else {
                                throwErrorTips('新增自定义失败',data.msg)
                            }
                        }.bind(this),
                        error: function(data){
                            throwErrorTips('新增自定义失败','')
                        }
                    })
                }else{
                    this.$Message({type:'error',message:'新增自定义失败，该自定义已存在'})
                }
            },
            removeCustom(id){
                jQuery.ajax({
                    url: delCustomUrl,
                    type: 'post',
                    data: {id: id},
                    success: function(data){
                        if(data.success){
                            this.customLis = this.customLis.filter(v => v.id != id)
                        }else {
                            throwErrorTips('删除自定义失败',data.msg)
                        }
                    }.bind(this),
                    error: function(data){
                        throwErrorTips('删除自定义失败',data.msg)
                    }
                })
            },
            // 显示新增自定义弹窗、选择类别、选择项目
            showCatalogPop(){
                this.isShowPop = true;
                this.isShowCataPop = true;
                this.classifyId = this.classifyLis[0].id
                this.classify = this.classifyLis[0].title
                this.catalogId = '';
                this.catalog = '';
                this.loadCatalog(0)
            },
            selectCatalog(id,title){
                this.catalogId = id;
                this.catalog = title;
            },
            selectClassify(id,title){
                this.classifyId = id;
                this.classify = title;
                this.catalogId = '';
                this.catalog = '';
                this.loadCatalog(0)
            },
            // 显示类别、项目、top5
            loadClassify(){
                this.classifyLis = []
                jQuery.ajax({
                    url: classifyUrl,
                    type:'post',
                    dataType: 'json',
                    cache: false,
                    success: function(data) {
                        if(data.success){
                            this.classifyLis = data.data.lis;
                            this.classifyid = data.data.lis[0].id
                            this.classify = data.data.lis[0].title
                        }else {
                            throwErrorTips('获取输送类型',data.msg)
                        }
                    }.bind(this)
                });
            },
            loadCatalog(num){ // 0:新增自定义 1:详情中的小类
                this.catalogLis = []
                jQuery.ajax({
                    url: catalogUrl,
                    type: 'post',
                    data: {classifyid: num == 0 ? this.classifyId : this.info.classifyId},
                    success: function(data){
                        if(data.success){
                            this.catalogLis = data.data.lis;
                        }else {
                            throwErrorTips('获取输送项目失败',data.msg)
                        }
                    }.bind(this),
                    error: function(data){
                        throwErrorTips('获取输送项目失败',data.msg)
                    }
                })
            },
            loadTopList(){
                jQuery.ajax({
                    url: topUrl,
                    type: 'get',
                    success: function(data){
                        if(data.success){
                            this.topLis = data.data
                        }else {
                            throwErrorTips('获取系统推荐失败',data.msg)
                        }

                    }.bind(this),
                    error: function(data){
                        throwErrorTips('获取系统推荐失败',data.msg)
                    }
                })
            },
            // 携带设备
            selectTackle(name){
                if(this.info.classify == '病人运送'){
                    if(this.info.tour == '' || this.info.tour == '无' || name == '无'){
                        this.info.tour = name;
                        this.tackleLis.forEach(v => {
                            v.title == name ? v.isActive = true : v.isActive = false;
                    })
                    }else{
                        // 判断name是否已在tackleLis当中
                        if(this.info.tour.indexOf(name) != -1){
                            let arr = this.info.tour.split(' / ');
                            this.info.tour = arr.filter(v => v != name).join(' / ')
                            this.tackleLis.forEach(v => {
                                if(v.title == name) v.isActive = false;
                        })
                        }else{
                            this.info.tour += ` / ${name}`
                            this.tackleLis.forEach(v => {
                                if(v.title == name) v.isActive = true;
                        })
                        }
                    }
                }else{
                    this.info.tour = name;
                    this.selectTab(0);
                }
            },
            loadTackle(){
                jQuery.ajax({
                    url: tackleUrl,
                    type:'post',
                    dataType: 'json',
                    cache: false,
                    success: function(data) {
                        if(data.success){
                            this.tackleLis = data.data.lis;
                            if(this.info.tour != ' ' && this.info.classify == '病人运送'){
                                this.tackleLis.forEach(v => {
                                    this.$set(v, 'isActive', false)
                            })

                                let arr = this.info.tour.split(' / ')
                                this.tackleLis.forEach(v => {
                                    arr.indexOf(v.title) != -1 ? v.isActive = true : v.isActive = false;
                            })
                            }
                        }else {
                            throwErrorTips('获取设置设备失败',data.msg)
                        }
                    }.bind(this)
                });
            },
            // 订单验证、提交
            submitCheck(){
                if(this.$root.$data.ssOffDuty){
                    this.$Message({type:'error',message:'输送调度不在服务时间内，请改用电话方式联系'});
                    return
                }
                if(this.info.askdept == ''){
                    this.$Message({type:'error',message:'请选择默认起点地址，再下单'});
                    return
                }
                let bad = this.info.bedno.trim();
                if(this.info.classify == '病人运送' && this.info.bedno.trim() == ''){
                    if(this.needSetBad){
                        this.$Message({type:'error',message:'请填写床号，方便我们派送'});
                        jQuery(".bedno").focus();
                        return
                    }else {
                        bad = '等医务人员待定'
                    }
                }
                if(isNaN(this.info.bedno)){
                    this.$Message({type:'error',message:'请输入有效数字'});
                    jQuery(".bedno").focus();
                    return
                }
                if(this.info.classify == '病人运送' && this.info.tour.trim() == ''){
                    this.$Message({type:'error',message:'请选择携带设备'});
                    return;
                }
                //预约时间比较
                if(this.orderTime.time != "") {
                    let setT = new Date(this.orderTime.time.replace(/-/g, "/"));
                    let nowT = new Date(
                        jQuery.ajax({ async: false }).getResponseHeader("Date")
                    );
                    let t = setT.getTime() - nowT.getTime();
                    if (t <= 0) {
                        this.$Message({type:'error',message:'预约时间必须大于现在的时间'})
                        return;
                    }else if(t >= 15*24*60*60*1000){
                        this.$Message({type:'error',message:'不能预约超15天'});
                        return
                    }
                }
                this.againSure = true;
                this.isSubmit = true;
            },
            submitForm(){
                if(this.isSubmit){
                    this.isSubmit = false;
                    let json = {};
                    json["classifyname"] = this.info.classify;
                    json["classifyid"] = this.info.classifyId.toString();
                    json["catalogname"] = this.info.catalog;
                    json["catalogid"] = this.info.catalogId.toString();
                    json["startaddr"] = this.info.askdept;
                    json["endaddr"] = this.info.address;
                    json["startbed"] = this.info.bedno.trim() == '' && !this.needSetBad ? '等医务人员待定' : this.info.bedno;
                    json["message"] = this.info.memo;
                    json["tackle"] = this.info.tour;
                    json["attribute"] = this.info.attribute.toString();
                    json["appointment"] = this.info.fixedtime;
                    let lis =  JSON.stringify(json);
                    jQuery.ajax({
                        url: submitUrl,
                        type:'post',
                        dataType: 'json',
                        cache: false,
                        timeout: 5000,
                        data:{'data':lis},
                        success: function(data) {
                            if(data.success){
                                this.$Message({type:'success',message:'提交成功'})
                                this.againSure = false;
                                if(!common.isEmptyObject(data.datat)){
                                    let socketJson = {};
                                    socketJson['istobg'] = true;
                                    socketJson['uid'] = '';
                                    socketJson['type']='1';
                                    socketJson['otype']='待分配';

                                    socketJson['id'] = String(data.datat.id);
                                    socketJson['sn'] = data.datat.sn;
                                    socketJson['classify'] = this.classify;
                                    socketJson['catalog'] = this.catalog;
                                    socketJson['site']= this.startRoom;

                                    this.$emit('sendsocket',JSON.stringify(socketJson));
                                }
                                this.isSubmit=true;

                                this.isShowPop = false;
                                this.isShowCataPop = false;
                                this.isShowConfirm = false;
                                this.clearInfo();
                            }else {
                                throwErrorTips('提交失败',data.msg)
                            }
                        }.bind(this),
                        error: function(XMLHttpRequest, textStatus, errorThrown) {
                            location.reload();
                        }
                    });
                }
            },
            closePop(){
                this.showIndex = 0;
                this.clearInfo();
                this.isShowPop = false;
                this.isShowCataPop = false;
                this.isShowConfirm = false;
            },
            clearInfo(){
                this.info.attribute = 1,
                    this.info.classifyId = '',
                    this.info.classify = '',
                    this.info.catalogId = '',
                    this.info.catalog = '',
                    this.info.bedno = '',
                    this.info.address = '',
                    this.info.tour = '',
                    this.info.memo = '',
                    this.info.fixedtime = ''
            },
            inputKey(){
                jQuery.ajax({
                    url: catalogInputUrl,
                    type:'post',
                    dataType: 'json',
                    data:{'no':this.keyTxt},
                    cache: false,
                    success: function(data) {
                        if(data.success){
                            if(!common.isEmptyObject(data.data)){
                                this.keyTxt = ''
                                let d = data.data;
                                this.info.classify = d.classifytitle;
                                this.info.classifyId = d.classifyid;
                                this.info.catalog = d.catalogtitle;
                                this.info.catalogId = d.catalogid;
                                this.info.address = d.zd;
                                this.showDetails(d, '下单')

                            }else{
                                return
                            }
                        }else {
                            throwErrorTips('',data.msg)
                        }
                    }.bind(this)
                });
            },
            setStartSite(){
                console.log("start",this.start);
                if(this.start == ""){
                    this.startRoom = '';
                    this.isStartOk = true;
                }else {
                    console.log("roomLis",this.roomLis);
                    if(this.roomLis.length == 1){
                        this.isStartOk = true;
                        this.startRoom = this.start;
                    }else {
                        let room = sessionStorage.getItem('preRomm');
                        var arr = this.start.split(' ');
                        if(arr.length > 1){
                            this.startRoom = arr[0] + ' '+ arr[1] + ' ';
                        }else {
                            this.startRoom = '';
                        }
                        if(room) {
                            this.isStartOk = true;
                        }else {
                            this.isStartOk = false;
                        }
                    }
                }
            }
        },
        created() {
            this.loadTopList();
            this.loadNewAddress();
            this.loadCustom();
            this.loadClassify();
            this.loadTackle();
            setTimeout(function(){
                common.inputOutline('.keyInput');
                this.setStartSite()
            }.bind(this),400)
        }
    }
</script>
<style scoped>
    .startLis {
        height: 100%;
        padding: 10px;
        overflow-y: auto;
    }
    .startLis div{
        display: inline-block;
        width: 210px;
        height: 210px;
        background-color: #ddd;
        margin: 10px;
    }
    .startLis div em {
        display: inline-block;
        vertical-align: middle;
        margin: 0;
        width: 2px;
        height: 100%;
        font-size: 0;
    }
    .startLis div span {
        display: inline-block;
        vertical-align: middle;
        margin: 0;
        width: calc(100% - 2px);
        line-height: 26px;
        text-align: center;
        font-size: 18px;
    }
    @media screen and (max-width: 1200px) {
        .startLis div {
            width: 157px;
            height: 157px;
        }
        .startLis div span {
            font-size: 16px;
        }
    }

</style>
